var mysql=require("mysql");  
var pool = mysql.createPool({  
    host: 'localhost',  
    user: 'root',  
    password: 'root',  
    database: 'music',  
    connectionLimit: 0     
});  
  
var query=function(sql,arr,callback){  
    pool.getConnection(function(err,conn){  
        if(err){  
            throw err;return;
        }else{  
            conn.query(sql,arr,function(qerr,vals,fields){  
                //释放连接  
                conn.release();  
                if(qerr) throw qerr;
                //事件驱动回调  
                callback(qerr,vals,fields);  
            });  
        }  
    });  
}; 
module.exports=query;